package com.youthHostel.serviceImpl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.youthHostel.dao.HouseDao;
import com.youthHostel.dao.UserDao;
import com.youthHostel.pojo.house;
import com.youthHostel.pojo.user;
import com.youthHostel.service.HouseService;
import com.youthHostel.service.UserService;

@Service
public class HouseServiceImpl implements HouseService{

	@Autowired
	private HouseDao houseDao;
	
	@Override
	public int addHouse(house houses) {
		return houseDao.insertHouse(houses);
	}

	@Override
	public PageInfo<house> findAllHouse(int index) {
		PageHelper.startPage(index, 3);
		List<house> queryHouseList = houseDao.queryHouseList();
		return new PageInfo<>(queryHouseList);
	}

	@Override
	public int removeHouserById(int id) {
		return houseDao.deleteHouseById(id);
	}

	@Override
	public house findHouseMesById(int id) {
		return houseDao.queryHouseMesById(id);
	}

	@Override
	public int updateHouserMes(house houses) {
		return houseDao.updateHouseMes(houses);
	}

	@Override
	public List<house> findHouseByKey(String name, int index) {
		return houseDao.queryHouseByKey(name);
	}

	@Override
	public List<house> selectAll() {
		return houseDao.selectAll();
	}

}
